package com.spring.component.easyexcel;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.spring.component.easyexcel.converter.WeekEnumConvert;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@ContentRowHeight(30)// 表体行高
@HeadRowHeight(20)// 表头行高
@ColumnWidth(35)//列宽
@Data
@NoArgsConstructor//需要有无参构造器
@AllArgsConstructor
public class DemoData {
  /**
   * ExcelProperty 列标题
   */
  @ExcelProperty("字符串标题")
  private String zan;
  /**
   * 格式化时间
   */
  @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
  @ExcelProperty("日期")
  private Date date;
  /**
   * 格式化百分比
   */
  @NumberFormat("#.##%")
  @ExcelProperty("百分比")
  private Double num;
  /**
   * converter 自定义格式转换
   */
  @ExcelProperty(value = "星期", converter = WeekEnumConvert.class)
  private WeekEnum no;
  /**
   * 忽略这个字段
   */
  @ExcelIgnore
  private String ignore;
}
